package com.buyantech.smweb.dao;

import javacommon.base.BaseHibernateDao;

import org.springframework.stereotype.Repository;
import cn.org.rapid_framework.page.Page;
import com.buyantech.smweb.model.ExchangeType;
import com.buyantech.smweb.vo.query.ExchangeTypeQuery;

@Repository
public class ExchangeTypeDao extends BaseHibernateDao<ExchangeType,java.lang.String>{

	@Override
	public Class getEntityClass() {
		return ExchangeType.class;
	}
	
	public Page findPage(ExchangeTypeQuery query) {
		String sql = "select t from ExchangeType t where 1=1 "
				+ "/~ and t.id = {id} ~/"
			  	+ "/~ and t.typename = {typename} ~/"
			  	+ "/~ and t.ratio = {ratio} ~/"
			  	+ "/~ and t.Isshow = {Isshow} ~/"
				+ "/~ order by [sortColumns] ~/";

        //生成sql2的原因是为了不喜欢使用xsqlbuilder的同学，请修改生成器模板，删除本段的生成
		return pageQuery(sql,query);
	}

	public Page searchPage(ExchangeTypeQuery query) {
        //XsqlBuilder syntax,please see http://code.google.com/p/rapid-xsqlbuilder
        // [column]为字符串拼接, {column}为使用占位符. [column]为使用字符串拼接,如username='[username]',偷懒时可以使用字符串拼接 
        // [column] 为PageRequest的属性
		String sql = "select t from ExchangeType t where 1=1 "
			  	+ "/~ and t.id like '%[id]%' ~/"
			  	+ "/~ and t.typename like '%[typename]%' ~/"
			  	+ "/~ and t.ratio like '%[ratio]%' ~/"
			  	+ "/~ and t.Isshow like '%[Isshow]%' ~/"
				+ "/~ order by [sortColumns] ~/";
        //生成sql2的原因是为了不喜欢使用xsqlbuilder的同学，请修改生成器模板，删除本段的生成
		return pageQuery(sql,query);
	}
 
}
